-
Notifications
You must be signed in to change notification settings - Fork 169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MWPW-153363] Countdown Timer implementation based on page metadata #2928
Conversation
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## stage #2928 +/- ##
==========================================
+ Coverage 96.24% 96.27% +0.02%
==========================================
Files 236 238 +2
Lines 54278 54515 +237
==========================================
+ Hits 52241 52485 +244
+ Misses 2037 2030 -7 ☔ View full report in Codecov by Sentry. |
I am waiting for access to promotions sheets to test this PR. For now, I have tested using injection. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a few nits, but most of those changes are imo required
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
nit, in createTag, last param can be { parent: container }, and it will be appended to container which should make you save a few lines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found a few things 👍
Let me know what you think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
i took a harder look at the cdt code as well this time and found these things. Once this is all fixed up should be good from my end.
} | ||
|
||
await Promise.all(promiseArr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
amazing, can you add a test example of a marquee with both mnemonic-list
& countdown-timer
to ensure this faster implementation also doesn't break anything?
function render(daysLeft, hoursLeft, minutesLeft) { | ||
if (!isVisible) return; | ||
|
||
removeCountdown(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why always remove the countdown ? Can you not just update the timer label?
@rahulgupta999 @npeltier @yesil the countdown timer is not respecting its own start and end time when using instant parameter. Rather checks your browser time to decide whether to show the timer or not. If you have a promo that lasts for some time (lets say 3 months) but want countdown timer to be shown only for a week inside that period, the current changes will show the timer as soon as the promo is active disregarding the defined timer starting date that comes later. Here we have a promo that started in March this year, and timer is set to start in September. If we look at the page with the date before September with instant param, the countdown timer is still shown. The same applied for the timers end date. cc: @Roycethan |
it is fixed now. The rest looks good to me. RTL is also supported. @rahulgupta999 could you please the failing check? I will mark this PR ready for stage |
} | ||
|
||
.horizontal .timer-block { | ||
margin-left: 10px; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
|
||
function isMobile() { | ||
return window.matchMedia('(max-width: 767px)').matches; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The value gets cached and will not work when rotating screens. You need to refactor this to always see if the viewport matches the width.
Example:
const isMobile = window.matchMedia('(max-width: 767px)');
if (isMobile.matches) doSomething(); // this will work after you resize or rotate screens.
* Fix RTL issues with Countdown Timer * UT fix * review comment * review comment * review comment * font fixes * do not reverse * Revert "UT fix" This reverts commit c7e4d1d. * added CDT in notifications standard variant * ends in vertical positioning fix * review comments * UT added for cdt in notification * lint * css fixes * minor fix * lint * css * update timer for instant query param * narcis review feedback incorporated from PR #2928 * minor refactoring * fix CDT alignment in media and modal block --------- Co-authored-by: Rohit Sahu <[email protected]>
* Fix RTL issues with Countdown Timer * UT fix * review comment * review comment * review comment * font fixes * do not reverse * Revert "UT fix" This reverts commit c7e4d1d. * added CDT in notifications standard variant * ends in vertical positioning fix * review comments * UT added for cdt in notification * lint * css fixes * minor fix * lint * css * update timer for instant query param * narcis review feedback incorporated from PR adobecom#2928 * minor refactoring * fix CDT alignment in media and modal block --------- Co-authored-by: Rohit Sahu <[email protected]>
As presented in AST, the regions have been using a ticker/timer/countdown visual to boost click-through rates and engagement as an enticement for certain promotions; e.g., Black Friday / Cyber Monday
Countdown Timer (CDT)
Properties:
Resolves: MWPW-153363
Test URLs:
Before: https://main--milo--adobecom.hlx.page/drafts/rahulgup/marquee-parent?martech=off
After: https://cdt-metatag--milo--rahulgupta999.hlx.page/drafts/rahulgup/marquee-parent?martech=off
This has the following authoring dependencies
New Placeholder texts are to be added in the placeholder file
{{cdt-ends-in}}
{{cdt-days}}
{{cdt-hours}}
{{cdt-mins}}
additionally, the following metadata should be present on the page
<meta name="countdown-timer" content="2024-08-26 12:00:00 PST,2024-09-30 00:00:00 PST">
Authoring documentation:
https://main--milo--adobecom.hlx.page/docs/authoring/promotions/countdowntimer